<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">

<title>Dashboard Template for Bootstrap</title>

<!-- Bootstrap core CSS -->
<link href="/web/libs/bootstrap/4.0/css/bootstrap.min.css" rel="stylesheet">

<!-- Custom styles for this template -->
<link href="/web/libs/bootstrap/4.0/css/dashboard.css" rel="stylesheet">
</head>

<body>
	<div id="header"></div>
	<div class="container-fluid">
		<div class="row">
			<div id="menu"></div>
			<main class="col-sm-9 offset-sm-3 col-md-10 offset-md-2 pt-3">
			<div class="col-lg-5">
					<div class="input-group">
						股票代码：<input type="text" class="form-control" id="queryCode"> 
						进度：<select id="proc" class="form-control">
							<option value="0">全部</option>
							<option value="4" selected="selected">实施</option>
							<option value="3">股东大会通过</option>
							<option value="2">预案</option>
							<option value="1">提议</option>
							<option value="5">完成</option>
							<option value="6">停止</option>
						</select>
						公告日期倒序:<input type="checkbox" id="asc" name="vehicle" checked="checked" />
					<span lass="input-group-btn"> <button class="btn btn-default" type="button" id="queryAction"> Go!</button> </span>
					</div>
				</div>
				
			<div id="rptList" style="width: 100%; hight: 100%; float: left；">
				<table class="table table-hover" id="cusTable">
				</table>
			</div>
			</main>
		</div>
	</div>

	<!-- Bootstrap core JavaScript
    ================================================== -->
	<!-- Placed at the end of the document so the pages load faster -->
	<script src="/web/libs/js/jquery-3.1.1.slim.min.js"
		integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n"
		crossorigin="anonymous"></script>
	<script src="/web/libs/js/tether.min.js"
		integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb"
		crossorigin="anonymous"></script>
	<script src="/web/libs/bootstrap/4.0/js/bootstrap.min.js"></script>
	<script src="/web/libs/js/common.js"></script>
	<script src="/web/libs/js/jquery.js"></script>
	<script src="/web/libs/js/dashboard/index.js"></script>
	<script src="/web/libs/bootstrap/4.0/js/bootstrap-table.js"></script>
	<script src="/web/libs/js/dashboard/basedata.js"></script>
	<script type="text/javascript">
		$("#header").load("/web/header.html")
		addActive("m_buyback");
		$('#cusTable').bootstrapTable('destroy');
		function loadData() {
			$('#cusTable').bootstrapTable('destroy');
			$("#cusTable").bootstrapTable(
					{
						method : "get", //使用get请求到服务器获取数据  
						url : "/web/buyback/list", //获取数据的Servlet地址  
						striped : true, //表格显示条纹  
						pagination : true, //启动分页
						cache : false,
						pageSize : 20, //每页显示的记录数  
						//pageNumber:1, //当前第几页  
						pageList : [ 10, 15, 20, 50 ], //记录数可选列表  
						search : false, //是否启用查询  
						//showColumns: true,  //显示下拉框勾选要显示的列  
						//showRefresh: true,  //显示刷新按钮  
						sidePagination : "server", //表示服务端请求
						//设置为undefined可以获取pageNumber，pageSize，searchText，sortName，sortOrder  
						//设置为limit可以获取limit, offset, search, sort, order  
						queryParamsType : "undefined",
						queryParams : function queryParams(params) { //设置查询参数  
							var code = $('#queryCode').val();
							var proc = $('#proc').val();
							var param = {
								pageNum : params.pageNumber,
								pageSize : params.pageSize,
							};
							param.asc = 0;
							if(!document.getElementById("asc").checked){
								param.asc = 1;
							}
							param.code = code;
							param.dtype = proc;
							return param;
						},
						columns : [ {
							field : 'code',
							title : '代码'
						}, {
							field : 'codeName',
							title : '名称'
						}, {
							field : 'ann_date',
							title : '公告日期'
						}, {
							field : 'proc',
							title : '实施进度'
						}, {
							field : 'end_date',
							title : '截止日期'
						}, {
							field : 'exp_date',
							title : '过期日期'
						}, {
							field : 'vol',
							title : '回购数量'
						}, {
							field : 'amountStr',
							title : '回购金额'
						}, {
							field : 'high_limit',
							title : '回购最高价'
						}, {
							field : 'low_limit',
							title : '回购最低价'
						}],
						responseHandler : function responseHandler(res) {
							
							var s1 = JSON.stringify(res.result);
							var s2 = '{"total":9999,"rows":' + s1 + '}';
							//alert(s2);
							return eval('(' + s2 + ')')
						},
						onLoadSuccess : function() { //加载成功时执行
							$("#rptList").show();
						},
						onLoadError : function() { //加载失败时执行  
							alert("加载数据失败");
						}
					});
		}
		
		$("#queryAction").click(function() {
				//alert("abc");
				loadData()
		});
		loadData();
	</script>
</body>
</html>
